package com.xhgj.thread;

/**
 * @author 周宇
 * @create 2020-06-27 1:53
 * 创建线程方式1
 */
//1、继承Thread类
public class PrimeThread extends Thread {
    long minPrime;

    PrimeThread(long minPrime) {
        this.minPrime = minPrime;
    }

    //2、重写run 方法
    @Override
    public void run() {
        for (int i = 1; i <= 2000; i++) {
            System.out.println("线程循环：" + i);
        }
    }

    public static void main(String[] args) {
        //3、start 启动运行
        PrimeThread p = new PrimeThread(143);
        p.start();

        for (int i = 1; i <= 2000; i++) {
            System.out.println("主线程循环：" + i);
        }
    }
}
